package com.t17;

import java.util.ArrayList;

/**
 * Created by xuyiwei on 2018/8/13.
 */

interface Generator<T> {
    T next();
}

class Government implements Generator<String> {
    String [] foundation = ("Stringa women lying in ponds distrinbuting swords is no basis for a system of government").split(" ");
    private int index;
    @Override
    public String next() {
        return foundation[index++];
    }
}
class CollectionData<T> extends ArrayList<T>{
    public CollectionData(Generator<T> gen,int splie) {
        for(int i=0;i<splie;i++){
            this.add(gen.next());
        }
    }
    public static <T> CollectionData<T> list(Generator<T> gen,int splie){
        return new CollectionData<T>(gen,splie);
    }
}
